<?php session_start(); ?>
<!DOCTYPE html>
<html style="overflow: hidden;" lang="en"><head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>BootCommerce Demo</title>    
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="BootCommerce is an E-commerce solution based on twitter bootstrap,perfect for any kind of shops.A complete Control Panel to manage Products, Categories, Orders,Clients and many system options">
    <meta name="keywords" content="e-commerce,ecommerce,bootstrap,twitter shop,shop,online sell,envato,codecanyon,template shop">
    <meta name="robots" content="INDEX,FOLLOW">
    <meta name="viewport" content="user-scalable=no,initial-scale=1.0, maximum-scale=1.0 width=device-width">
    <!-- Styles -->
    	 
	<link href="BootCommerce%20Demo_files/bootstrap.css" rel="stylesheet">
	<link href="BootCommerce%20Demo_files/bootstrap_extensions.css" rel="stylesheet">
	<link href="BootCommerce%20Demo_files/addons.css" rel="stylesheet">   
	<link href="BootCommerce%20Demo_files/bootstrap-responsive.css" rel="stylesheet">
	<link href="BootCommerce%20Demo_files/bootstrap_responsive_extensions.css" rel="stylesheet">
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="include/js/html5shiv.js"></script>
    <![endif]--> 
    <link href="BootCommerce%20Demo_files/general-style.css" rel="stylesheet">       
    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="include/img/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="include/img/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="include/img/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="include/img/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="include/img/ico/apple-touch-icon-57-precomposed.png">
    <!--[if lt IE 9]>
        <script src="include/js/html5shiv.js"></script>
    <![endif]--> 
    <link href="BootCommerce%20Demo_files/slideshow.css" rel="stylesheet">  
  </head>  
  <body>
   <div class="scroll_body_container"><!-- CONTAINER FOR NICESCROLL PLUGIN (FIX CHROME SCROLLING PROBLEM) this will be closed into footer.php file -->
<section class="container-fluid" id="top-bar"> <!-- CONTAINER -->
<?php require("include/connect.php"); ?>
  <div class="container-semifluid">
    <div class="row-fluid">
         <div class="span7">
           <div id="top-login-form-container">
              <form novalidate="novalidate" method="post" action="check.php" accept-charset="UTF-8" id="top-login-form">
                     <div class="control-group pull-left">
                       <div class="controls">
                         <div class="input-prepend">
                          <span class="add-on"><i class="icon-user"></i></span>
                          <input autocomplete="off" name="useridLog" id="top-useridLog" class="required" placeholder="UserID" type="text">
                         </div>
                       </div>
                     </div>
                     <div class="control-group pull-left">
                       <div class="controls">
                         <div class="input-prepend">
                          <span class="add-on"><i class="icon icon-black icon-key"></i></span>
                          <input name="passwordLog" id="top-passwordLog" class="required" placeholder="Password" value="" type="password">
                        </div>
                      </div>
                    </div>
                    <span class="btn btn-info unbordered solid squared" id="top-btn-login"><i class="icon icon-white icon-unlocked"></i> Login</span>
                    <div class="clearfix"></div>
              </form>
              <a href="#" class="retrieve-data">Forgotten Data?</a> | <a href="">Sign up</a>
           </div>
                         <div class="welcome-message">Welcome on Q8 Movies <a href="" id="btn-login-link">Login</a> | <a href="">Sign up</a></div>
                  </div>
       <div class="span1 text-right">
      	 <select style="width: 0px; height: 0px; outline: medium none; padding: 0px; margin: 0px; opacity: 0;" id="default_client_language" class="change_language_on_the_fly bootstyl text-left solid unbordered" name="default_client_language" data-verse="right">
  <option data-img-before="&lt;img src=&quot;lang/en_US/en_US.png&quot; style=&quot;margin-right:10px;&quot; /&gt;" value="en_US" selected="selected"></option><option data-img-before="&lt;img src=&quot;lang/it_IT/it_IT.png&quot; style=&quot;margin-right:10px;&quot; /&gt;" value="it_IT"></option></select>
       </div>
       <div class="span4">
		   <div class="row-fluid">
    <div class="span12 text-right">
           <ul class="nav topcart">
		   <style>
		   #shopping-cart-btn, .shopping-cart-btn {
				margin: 10px 15px 5px 15px;
				}
				.btn-sm, .btn-group-sm>.btn {
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.btn-default {
color: #333 !important;
background-color: #fff !important;
border-color: #ccc !important;
}
.btn {
display: inline-block !important;
padding: 6px 12px !important;
margin-bottom: 0 !important;
font-size: 14px !important;
font-weight: 400 !important;
line-height: 1.42857143 !important;
text-align: center !important;
white-space: nowrap !important;
vertical-align: middle !important;
cursor: pointer !important;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
user-select: none;
background-image: none !important;
border: 1px solid transparent !important;
border-radius: 4px !important;
}
.glyphicon {
position: relative !important;
top: 1px !important;
display: inline-block !important;
font-family: 'Glyphicons Halflings' !important;
font-style: normal !important;
font-weight: 400 !important;
line-height: 1 !important;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
		   </style>
                <li class="dropdown">  
				<span class="dropdown-toggle" data-toggle="dropdown">				
				<a href="" class="shopping-cart-btn btn btn-default btn-sm navbar-right"><strong>0</strong> items of <strong>$0.00 USD</strong> in your <i class="glyphicon glyphicon-shopping-cart"></i></a>              
				</span>
				   <ul class="dropdown-menu squared">
                        <li>
                            <table>
                                <tbody class="product-tbody-container">
                                                                  </tbody>
                            </table>
                                                        <table>
                                <tbody class="counts-container">
                                    <tr>
                                        <td class="text-right"><strong>Subtotal:</strong></td>
                                        <td class="text-right subtotal">$ 0.00</td>
                                    </tr>
                                    <tr>
                                        <td class="text-right"><strong>Vat:</strong></td>
                                        <td class="text-right tax">$ 0.00</td>
                                    </tr>
									                                    
                                    <tr>
                                        <td class="text-right"><strong>Total:</strong></td>
                                        <td class="text-right total">$ 0.00</td>
                                    </tr>
                                </tbody>
                            </table>
                                                       <div class="text-center cart-options-container"> <a class="btn btn-info squared solid unbordered" href="">Cart</a> <a class="btn btn-primary squared solid unbordered" href="">Checkout</a> </div>
                        </li>
                    </ul>
                </li>
            </ul>    
    </div>
  </div>       </div>
    </div>
  </div>
</section>
<header>
 <section class="container-semifluid" id="header-container"> <!-- CONTAINER -->
  <div class="row-fluid"> <!-- ROW -->
    <div class="span4 logo-container">
      <a href=""><img src="BootCommerce%20Demo_files/bc_logo.png" alt="http://www.mrplugins.it/bootcomemrce"></a>
    </div>
    <div class="span3 text-right">
              <form id="search-form" class="form-search form-horizontal" action="search.php" method="get">
            <div class="input-append span12">
                <input autocomplete="off" name="sp" class="search-query" placeholder="Search..." type="text">
                <button type="submit"><i class="icon-search"></i></button>
            </div>
        </form>
          </div>
    <div class="span5 main-menu-container text-right">
      <a href=""><i class="icon-user"></i> Your Account</a>
      <a href=""><i class="icon-shopping-cart"></i> Shopping Cart</a>
      <a href=""><i class="icon-ok-circle"></i> Checkout</a>
      <a href=""><i class="icon icon-black icon-contacts"></i> Contact Us</a>
    </div>
  </div> <!-- /ROW -->
 </section>
</header>
<div class="clearfix"></div>    
   <section class="container-semifluid" id="main-container"> <!-- CONTAINER -->     
           <div class="row-fluid" style="position:relative;">
        <div class="span12 carousel_wrapper horizontal-category"   style="display:none">                                 
          <span style="display: block;" class="carousel-prev disabled" id="carousel-category-prev"></span>
          <div style="display: block; text-align: start; float: none; position: relative; top: auto; right: auto; bottom: auto; left: auto; z-index: auto; width: 1170px; height: 40px; margin: 0px 0px 20px; overflow: hidden;" class="caroufredsel_wrapper"><ul style="text-align: left; float: none; position: absolute; top: 0px; right: auto; bottom: auto; left: 0px; margin: 0px; width: 4432px; height: 40px;">       
             
              <li>
                <a href="" >Option 1</a>
              </li>
             
              <li>
                <a href="">Option 2</a>
              </li>
             
              <li>
                <a href="" >Option 3</a>
              </li>
             
              <li>
                <a href="" >Option 4</a>
              </li>
             
              <li>
                <a href="" >Option 5</a>
              </li>
             
             <li>
                <a href="" >Option 6</a>
              </li>
             
			 <li>
                <a href="" >Option 7</a>
              </li>
             
              <li>
                <a href="" >Option 8</a>
              </li>
             
             <li>
                <a href="" >Option 9</a>
              </li>
             
               <li>
                <a href="" >Option 10</a>
              </li>
             
             <li>
                <a href="" >Option 11</a>
              </li>
             
			 <li>
                <a href="" >Option 12</a>
              </li>
             
              <li>
                <a href="" >Option 13</a>
              </li>
             
             <li>
                <a href="" >Option 14</a>
              </li>
             
             <li>
                <a href="">Option 15</a>
              </li>
             
           </ul></div>            
          <span style="display: block;" class="carousel-next" id="carousel-category-next"></span>                                   
        </div> 
        <span style="left: 192px; width: 0px;" class="categories_menu_indicator"></span>       
       </div> 
  <section class="row-fluid"><!-- BODY ROW --> 
       <section class="span3 left-sidebar-container"> 
             <aside class="left-sidebar">
      <nav id="categories-menu">
       <div class="head default-head">
          <div class="box-header">
             <span class="header-text">Categories</span>
          </div>          
       </div>
	 <?php
		if($_GET['wm'] == "list"){
			$type = "list";
		}else{
			$type = "grid";
		}
    ?>   
       <div class="label label-info responsiveHead"><h4>Categories <i class="col-menu"></i></h4></div>
                <div class="accordion_menu_container responsiveMenu">
                  <ul class="nav nav-list nav-pills nav-stacked last_active" id="accordion-categories-menu">
					<li style="position:relative;">
                       <a data-breadcrumb="129" class="link" href="grid.php?wm=<?=$type;?>&catid=0">all category</a>                       
                     </li>    
				     <?php $category_list = mysqli_query($con,"SELECT * FROM category where CategoryID != 16")OR DIE(mysqli_errno());
						$cat_numrows = mysqli_num_rows($category_list);
						$cat_counter = 0;
						while($cat_row=mysqli_fetch_assoc($category_list))
						{
							$CategoryID = $cat_row['CategoryID'];
							$cName = $cat_row['cName'];
					 ?>
                     <li style="position:relative;">
                       <a data-breadcrumb="129" class="link" href="<?=$url;?>?wm=<?=$type;?>&catid=<?=$CategoryID;?>"><?=$cName;?></a>                       
                     </li>                  	
				             
                   <?php } ?>              	
				                   </ul>                    
                </div> 
      </nav>        
     </aside> 
        <br>  
           <aside class="left-sidebar">
               <nav class="accordion_menu_container">
               <div class="head default-head">
                  <div class="box-header">
                     <span class="header-text">Shopping by</span>
                  </div>          
               </div>
               <div class="label label-info responsiveHead"><h4>Shopping by <i class="col-menu"></i></h4></div>
                <div class="responsiveMenu">  
                  <br> 
                   
                <div style="background:#fff;border:1px solid #09c;padding:5px;"> 
                  <label class="checkbox" for="offer_filter"><span class="icons"><span class="first-icon fui-checkbox-unchecked"></span><span class="second-icon fui-checkbox-checked"></span></span><input type="checkbox" data-toggle="checkbox" id="offer_filter">Only On Offer</label> 
                </div>
                <br><br>
                 <div class="pull-left">
                  $ 0.00                  </div>
                  <div class="pull-right">
                  $ 52.69                  </div>                  
                  <div class="row-fluid">
                    <span class="span12">
                      <div class="slider slider-horizontal"><div class="slider-track"><div class="slider-selection" style="left: 0%; width: 100%;"></div><div class="slider-handle round" style="left: 0%;"></div><div class="slider-handle round" style="left: 100%;"></div></div><div class="tooltip top in" style="top: -40px; left: 127px;"><div class="tooltip-arrow"></div><div class="tooltip-inner"> from <strong> $0,00 </strong> to <strong> $52,69 <strong></strong></strong></div></div><input type="text" id="slider" calss="span12" value="" data-slider-min="0" data-slider-max="52.6864" data-slider-step="1" data-slider-value="[0,52.6864]" data-slider-orientation="orizontal" data-slider-selection="after" data-slider-tooltip="show" autocomplete="off"></div>
                    </span>
                  </div>
                  <br> 
                <div class="pull-left btn btn-warning" id="btn-reset-filter"><i class="icon-refresh icon-white"></i> Reset filters</div>
                <div class="pull-right btn btn-success" id="btn-filter"><i class="icon-filter icon-white"></i> filter</div>
                <br><br>  
                 </div>
                </nav>                                  
           </aside>                     		  
        </section>
	<?php
		if(isset($_GET['catid']))
		{
			$catg = $_GET['catid'];
			$extract2cat = mysqli_query($con,"SELECT * FROM category") or die (mysql_error());
			
			while ($catig = mysql_fetch_assoc($extract2cat))
			{
				$categ = $catig['CategoryID'];
				if($categ == $catg)
				{
					$catgName = $catig['cName'];
					$catg = $catgName;
					$heading= "Q8movies.com :: $catg";
				}
			}
		}
		else
		{
			$heading = "Q8movies.com :: TOP Release";
		}
		
		$pgsize=12;
	$num1=0;
	if(isset($_GET["p"]))
	{
		$pg=(is_numeric($_GET["p"]) ? $_GET["p"] : 1); 
		
	}
	else
	{
		$pg=1;
	}
	
	$start=($pg-1)*$pgsize; 
	
	if(isset($_GET['catid']) && $_GET['catid'] != 0)
	{
		$required_cat = $_GET['catid'];
		$imgs=mysqli_query($con, "SELECT * FROM product where CategoryID=$required_cat AND CategoryID != 16  ORDER BY ProductID DESC LIMIT $start, $pgsize");
	}
	else
	{
		$imgs=mysqli_query($con, "SELECT * FROM product where CategoryID != 16 ORDER BY ProductID DESC LIMIT $start, $pgsize");
	}

	
	
	$img_total=mysqli_query($con,"SELECT COUNT(1) FROM product");
	$img_total=mysqli_fetch_row($img_total);
	$img_total=$img_total[0];
	$max_pages2=ceil($img_total/$pgsize);


	
	$max_pages=7;
	
	/*HELPER FUNCTIONS*/
	function printPager($max_pages,$pg,$type){
		
		$pgsize=12;
		if(isset($_GET["p"]))
		{
			$pg=(is_numeric($_GET["p"]) ? $_GET["p"] : 1); 
		}
		else
		{
			$pg=1;
		}
		$start=($pg-1)*$pgsize; 
		
		$imgs=mysqli_query($con,"SELECT * FROM product  ORDER BY ProductID DESC LIMIT $start, $pgsize ");
		$img_total=mysqli_query($con,"SELECT COUNT(1) FROM product");
		$img_total=mysqli_fetch_row($img_total);
		$img_total=$img_total[0];
		$max_pages2=ceil($img_total/$pgsize);
		
	
	
		print '<div class="clearr"></div>';
		print '<ul class="pager">';
		$i=$pg; //$i = $pg-3;
		if($pg!=1)
		{
			$url=$_SERVER["SCRIPT_NAME"];
			
			
			if(isset($_GET["catid"]))
			{
				$required_cat = $_GET["catid"];
				$url.=add_querystring_var("?","p", $pg-1);
				$url = $url. '&catid=' .$required_cat. '&wm=' .$type;
				print '<li class="prev"><a href="'.$url.'"><<</a></li>';
			}
			else
			{
				$url.=add_querystring_var("?","p", $pg-1);
				$url = $url.'&wm=' .$type;
				print '<li class="prev"><a href="'.$url.'"><<</a></li>';
			}
		}
		$num1=0;
		if($pg==5)
		{
			$num1=1;
		}
		if($pg==6)
		{
			$num1=2;
		}
		if($pg >=7)
		{
			$num1=3;
		}
		if(isset($num1))
		{
			
			if($pg<=4)
			{
				$i=1;
				$maxx = $max_pages  + $num1;
			}
			else if($pg ==5)
			{
				$i=$i-3;
				$maxx = $pg  + 3;
			}
			else if($pg >5)
			{
				$i=$i-3;
				$maxx = $pg  + 3;
			}
		}
		
		while($i<=$maxx)
		{
			if(isset($_GET["catid"]))
			{
				$required_cat = $_GET["catid"];
				$url=$_SERVER["SCRIPT_NAME"];
				$url.=add_querystring_var("?","p", $i);
				$url = $url. '&catid=' .$required_cat.'&wm='.$type;
				if($pg==$i)
				{
					print '<li class="current">';
					print '<span>'.$i.'</span>';
					print "</li>";
				}	
				else
				{
					print "<li>";
					print '<a href="'.$url.'">'.$i.'</a>';
					print "</li>";
				}
			$i++;
			}
			else
			{
				$url=$_SERVER["SCRIPT_NAME"];
				$url.=add_querystring_var("?","p", $i);
				$url = $url.'&wm=' .$type;
				if($pg==$i)
				{
					print '<li class="current">';
					print '<span>'.$i.'</span>';
					print "</li>";
				}	
				else
				{
					print "<li>";
					print '<a href="'.$url.'">'.$i.'</a>';
					print "</li>";
				}
			$i++;
			}
		}


		if($pg!=$max_pages2)
		{
			if(isset($_GET["catid"]))
			{
				$required_cat = $_GET["catid"];
				$url=$_SERVER["SCRIPT_NAME"];
				$url.=add_querystring_var("?","p", $pg+1);
				$url = $url. '&catid=' .$required_cat.'&wm='.$type;
				print '<li class="next"><a href="'.$url.'">>></a>';
				
			}
			else
			{
				$url=$_SERVER["SCRIPT_NAME"];
				$url.=add_querystring_var("?","p", $pg+1);
				$url = $url. '&wm='.$type;
				print '<li class="next"><a href="'.$url.'">>></a>';
				
			}
			
		}
		print '</ul>';
		print '<div class="clearr"></div>';
	
	}

	function add_querystring_var($url, $key, $value) 
	{
		$url = preg_replace('/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&'); 
		$url = substr($url, 0, -1); 
		if (strpos($url, '?') === false) 
		{ 
			return ($url . '?' . $key . '=' . $value); 
		} 
		else 
		{ 
			return ($url . '&' . $key . '=' . $value); 
		} 
	} 
	?>
<?php if($_GET['wm'] == "list"){ ?>		
	<section class="span9">
		<section id="filter-bar" class="span12">
		   <div id="view-mode" class="pull-left">
			 <h3><?=$heading;?></h3>
			 <a class="grid-view" href="?p=1&amp;wm=grid"></a><span class="list-view active"></span> 
		   </div>                
		   <div id="sort-by" class="pull-right"></div>
		   <div id="order-by" class="pull-right">
			  <a href="?p=1&amp;wm=list&amp;ob=desc"><i class="sort-by asc"></i></a>
			   <strong class="text-info">Sort by: </strong>
				<select id="products_sortby" class="bootstyl text-left" data-additional-classes="btn-info solid unbordered" data-verse="right" style="width: 0px; height: 0px; outline: none; padding: 0px; margin: 0px; opacity: 0;">
				  <option value="?p=1&amp;wm=list&amp;sb=name" selected="">Name</option>                   
				  <option value="?p=1&amp;wm=list&amp;sb=price_order">Price</option>
				  <option value="?p=1&amp;wm=list&amp;sb=code">Code</option>                  
				</select>
				<div class="btn-group btn-group-styled" id="styledselectproducts_sortby">		
				  <a class="btn dropdown-toggle btn-info solid unbordered" data-toggle="dropdown" href="#">
					<span class="text-select-container">Name</span> <span class="caret"></span>
				  </a>			
				  <ul class="dropdown-menu pull-right">
					  <li><a href="#" rel="?p=1&amp;wm=list&amp;sb=name">Name</a></li>
					  <li><a href="#" rel="?p=1&amp;wm=list&amp;sb=price_order">Price</a></li>
					  <li><a href="#" rel="?p=1&amp;wm=list&amp;sb=code">Code</a></li>
				  </ul>		 
				</div>
		   </div>              
		   <div class="clearfix"></div>
		</section>   
<?php 																		
printPager($max_pages, $pg, $type);
if(isset($_GET["p"]))
{
	$curPage=$_GET["p"];
}
else
{
	$curPage=1;
}

//lets loop through items 

	$td_counter =0;
while ($row = mysqli_fetch_assoc($imgs))
	{
		
			$td_counter = $td_counter + 1;
			$PID1 = $row['ProductID'];
			$image = $row['ProductCode'];
			$pname = $row['ProductName'];
			$im    = $row['SmallImage'];
			$onpage =$_SERVER["SCRIPT_NAME"];
			$links = $row['SpecialLink'];
			$desc = $row['ProductDesc'];
			$price = $row['Price'];
			if($PID1>12310)
			{
				$im= substr($im, 0, -4);
				$im="poster/".$im."_thumbnail.jpg";
			}
			else if($PID1<=12310)
			{
				$im="poster/".$im;
			}
			
	 ?>
				
				<div class="row-fluid">
                   <div class="span12">
                    <article class="product-container-list" data-exstend-link="on"> 
                      <div class="row-fluid">
                         <section class="product-img span4">
							                         
                           <div class="img-thumb"> 
                                                                                                            
                             <a href="<?php if($link == NULL){ echo $image;} else{ echo $link; }?>"><img class="lazy" data-original="http://q8movies.com/<?=$im;?>" src="http://q8movies.com/<?=$im;?>" alt="product1" style="display: inline;"></a>
                           </div>
                         </section>
                         <section class="product-detail-container text-left span8">
                          <div class="row-fluid">
                             <div class="span7">
                               <section class="product-name" title="product1"><a href="<?=$image;?>"><?=$pname;?></a></section>
                               <section class="description"><?=$desc;?></section>
                             </div>
                             <div class="span5 text-right">
                               <section class="price-container text-right"><?=$price?>.00</section>
                               <section class="action-container text-right">  
								     
                                      <a href="<?=$image;?>" data-rel-name="product1" data-rel-img="" class="add-to-cart-small  without-options" data-id="26">Add to Cart</a> 
                                                                        
                               </section>
                             </div>
                           <div class="clearfix"></div>
                          </div>
                         </section> 
                      </div>                      
                    </article>
                   </div>
                  </div>      
                  <hr>  
			 
				<?php	}  ?>			
			                         
    </section>
				
				<?php }else{?>
	<section class="span9">
		<section id="filter-bar" class="span12">
		   <div id="view-mode" class="pull-left">
			 <h3><?=$heading;?></h3>
			 <a class="grid-view" href="?p=1&amp;wm=grid"></a><span class="list-view active"></span> 
		   </div>                
		   <div id="sort-by" class="pull-right"></div>
		   <div id="order-by" class="pull-right">
			  <a href="?p=1&amp;wm=list&amp;ob=desc"><i class="sort-by asc"></i></a>
			   <strong class="text-info">Sort by: </strong>
				<select id="products_sortby" class="bootstyl text-left" data-additional-classes="btn-info solid unbordered" data-verse="right" style="width: 0px; height: 0px; outline: none; padding: 0px; margin: 0px; opacity: 0;">
				  <option value="?p=1&amp;wm=list&amp;sb=name" selected="">Name</option>                   
				  <option value="?p=1&amp;wm=list&amp;sb=price_order">Price</option>
				  <option value="?p=1&amp;wm=list&amp;sb=code">Code</option>                  
				</select>
				<div class="btn-group btn-group-styled" id="styledselectproducts_sortby">		
				  <a class="btn dropdown-toggle btn-info solid unbordered" data-toggle="dropdown" href="#">
					<span class="text-select-container">Name</span> <span class="caret"></span>
				  </a>			
				  <ul class="dropdown-menu pull-right">
					  <li><a href="#" rel="?p=1&amp;wm=list&amp;sb=name">Name</a></li>
					  <li><a href="#" rel="?p=1&amp;wm=list&amp;sb=price_order">Price</a></li>
					  <li><a href="#" rel="?p=1&amp;wm=list&amp;sb=code">Code</a></li>
				  </ul>		 
				</div>
		   </div>              
		   <div class="clearfix"></div>
		</section>   
			 <div class="row-fluid">   
		 
<?php 																		
printPager($max_pages, $pg, $type);
if(isset($_GET["p"]))
{
	$curPage=$_GET["p"];
}
else
{
	$curPage=1;
}

//lets loop through items 

	$td_counter =0;
while ($row = mysqli_fetch_assoc($imgs))
	{
		
			$td_counter = $td_counter + 1;
			$PID1 = $row['ProductID'];
			$image = $row['ProductCode'];
			$pname = $row['ProductName'];
			$im    = $row['SmallImage'];
			$onpage =$_SERVER["SCRIPT_NAME"];
			$links = $row['SpecialLink'];
			$desc = $row['ProductDesc'];
			$price = $row['Price'];
			if($PID1>12310)
			{
				$im= substr($im, 0, -4);
				$im="poster/".$im."_thumbnail.jpg";
			}
			else if($PID1<=12310)
			{
				$im="poster/".$im;
			} 
 ?>		
			            
			 <div class="span3">
                    <article class="product-container-grid" data-exstend-link="on"> 
                     <section class="product-img">                     
                       <div class="img-thumb">                            
                         <a href="<?php if($link == NULL){ echo $image; }else{ echo $link; }?>"><img class="lazy" data-original="" src="http://q8movies.com/<?=$im;?>" alt="product1" style="display: inline;"></a>
                       </div>
                     </section>
                     <section class="product-detail-container text-center">
                       <section class="product-name" title="product1"><a href="<?php  if($link == NULL){ echo $image; }else{ echo $link; } ?>"><?=$pname; ?></a></section>
                       <section class="price-container"><?=$price;?>Rs</section>
                       <section class="action-container text-center">                 
                            <a href="" data-rel-name="<?=$pname;?>" data-rel-img="http://q8movies.com/<?=$im;?>" class="addtocart add-to-cart-small without-options" data-id="<?=$PID1;?>">Add to Cart</a>                                                          
                       </section>
                       <div class="clearfix"></div>
                     </section>                       
                    </article>   
               </div>                                
			  <br>
			 <?php  } ?>
			</div>			  
			
		<?php } ?>
     </section>  
         
   </section> <!-- /CONTAINER -->
	<footer>
  <div class="container-fluid" id="footer">
   <div class="container-semifluid">   
      <div class="row-fluid">
        <div class="span6">        
          <img src="BootCommerce%20Demo_files/bc_logo_footer.png" alt="http://www.mrplugins.it/bootcomemrce" width="30%">
          <p style="text-align:justify">
          "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed
 do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim 
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut 
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit 
in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
Excepteur sint occaecat cupidatat non proident, sunt in
          </p>
         <div class="clearfix"></div>
        </div>
        <div class="span3">
          <div class="box-header">
            <span class="header-text" style="white-space:nowrap;">Your Account</span>   
          </div>         
         <ul class="menu-vertical-indicator">
           <li><a href="">General Info</a></li>
           <li><a href="">Addresses</a></li>
           <li><a href="">Orders</a></li>
           <li><a href="">Contact Us</a></li>
         </ul>
         <div class="clearfix"></div>
        </div>
        <div class="span3">
          <div class="box-header">
            <span class="header-text" style="white-space:nowrap;">Contact Us</span>   
          </div>         
         <ul>
           <li><img src="BootCommerce%20Demo_files/footer-phone.png">1234564545</li>
           <li><img src="BootCommerce%20Demo_files/footer-email.png"> contact@q8movies.com</li>
           <li><img src="BootCommerce%20Demo_files/footer-marker.png"> abc, xyz</li>
         </ul>
         <div class="clearfix"></div>
        </div>       
                     
      </div>
      
   </div>
  </div>    
</footer>
<!-- retrieve user's data form -->						 
<div id="retrieve-data-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="retrieve-data-modallabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="icon-remove"></li></button>
    <span id="retrieve-data-modallabel"><strong class="label label-info">Retrieve Your access data</strong></span>
  </div>  
  <div class="modal-body">
     <div id="retrieve-result" class="hide"></div>
     <form novalidate="novalidate" method="post" action="retrieve-data.php" accept-charset="UTF-8" id="retrieve-data-form">    		  
         <div class="control-group">
           <div class="controls">
            <label for="userid-retrieve">UserID</label>
             <div class="input-prepend">
              <span class="add-on"><i class="icon-user"></i></span>              
              <input autocomplete="off" name="userid_retrieve" id="userid-retrieve" class="leastoneinput" placeholder="UserID" type="text">   
             </div> 
           </div>                       
         </div>
         <div class="control-group">
           <div class="controls">  
             <label for="email-retrieve">E-mail</label> 
             <div class="input-prepend">                          
              <span class="add-on"><i class="icon-envelope"></i></span>              
              <input autocomplete="off" name="email_retrieve" id="email-retrieve" class="leastoneinput email" placeholder="E-mail" type="text">
            </div>
          </div>                                           
        </div>   
        <span class="btn btn-info unbordered solid squared pull-right" id="btn-retrieve-data"><i class="icon-white icon-wrench"></i> Retrieve data</span>
        <div class="clearfix"></div>              
       </form>  
  </div>
</div> 
<!-- / retrieve user's data form -->							
<a style="" id="go-to-top"></a>
</div><!-- CLOSE CONTAINER FOR NICESCROLL PLUGIN (FIX CHROME SCROLLING PROBLEM), div opened into body-header.php file -->
    <!-- ========================== Javascript ======================== -->  

    <script src="BootCommerce%20Demo_files/jquery_003.js"></script>
	<script src="BootCommerce%20Demo_files/bootstrap.js"></script>
	<script src="BootCommerce%20Demo_files/bootstrap_extensions.js"></script>    
	<script type="text/javascript" src="BootCommerce%20Demo_files/jsin.js"></script>
    <script type="text/javascript" src="BootCommerce%20Demo_files/en_US.js"></script>    
    <script type="text/javascript" src="BootCommerce%20Demo_files/ajaxForm.js"></script> 
    <script type="text/javascript" src="BootCommerce%20Demo_files/livequery.js"></script> 
    <script type="text/javascript" src="BootCommerce%20Demo_files/center-div.js"></script>  
    <script type="text/javascript" src="BootCommerce%20Demo_files/loader.js"></script>  
    <script type="text/javascript" src="BootCommerce%20Demo_files/jquery_010.js"></script> 
   
	<script type="text/javascript">
	
    $(function(){
	  /*$("html").niceScroll({cursorcolor:'#3A87AD',cursorborder:'1px solid #fff'});*/
	  $('body').data('theme_path','content/themes/default');
	  $('body').data('theme_img_path','http://grabwebs.com/commerce/BootCommerce Demo_files');
	  $('body').data('abs_client_path','http://grabwebs.com/commerce');
	  $('body').data('thousands_separator',',');
	  $('body').data('decimals_separator','.');	  
	  	  	
	      $("html").niceScroll({cursorcolor:'#3A87AD',cursorborder:'0px solid #fff',cursorwidth:8});
		  $('.responsiveHead').on('click', function(e) {
			  e.preventDefault();			  
			  if(!$(this).next('.responsiveMenu').is(':visible')){
				  $(this).next('.responsiveMenu').slideDown('fast');
			  }else{				  
				  $(this).next('.responsiveMenu').slideUp('fast');
			  }
		  });	
	      
    });
    </script>    
    <!--[if lt IE 9]>
        <script type="text/javascript" src="content/themes/default/js/ie_hacks.js"></script>        
    <![endif]-->
    <script type="text/javascript" src="BootCommerce%20Demo_files/main_script.js"></script>   
         
   <script type="text/javascript" src="BootCommerce%20Demo_files/jquery_006.js"></script> 
   <script type="text/javascript" src="BootCommerce%20Demo_files/jquery_008.js"></script> 
  
<div style="width: 8px; z-index: auto; cursor: default; position: fixed; top: 0px; height: 100%; right: 0px; opacity: 0;" class="nicescroll-rails " id="ascrail2000">
<div style="position: relative; top: 0px; float: right; width: 8px; height: 207px; background-color: rgb(58, 135, 173); border: 0px solid rgb(255, 255, 255); background-clip: padding-box; border-radius: 0px;">
</div>
</div>
<div style="height: 8px; z-index: auto; position: fixed; left: 0px; width: 100%; bottom: 0px; cursor: default; opacity: 0; display: none;" class="nicescroll-rails" id="ascrail2000-hr">
<div style="position: relative; top: 0px; height: 8px; width: 1366px; background-color: rgb(58, 135, 173); border: 0px solid rgb(255, 255, 255); background-clip: padding-box; border-radius: 0px; left: 0px;">
</div>
</div>
</body>
</html>